FROM php:7.3.8-fpm

RUN apt-get update && apt-get install zlib1g-dev -y \
        libmcrypt-dev \
        libpq-dev \
        libjpeg-dev \
        libpng-dev \
        libzip-dev \
        xvfb libfontconfig \
        libgmp-dev \
    && docker-php-ext-install -j$(nproc) pdo \
    && docker-php-ext-install -j$(nproc) pdo_mysql \
    && docker-php-ext-install -j$(nproc) gd \
    && docker-php-ext-install -j$(nproc) zip \
    && docker-php-ext-install -j$(nproc) gmp \
    && docker-php-ext-install -j$(nproc) bcmath \
    && docker-php-ext-install -j$(nproc) pcntl

# install zookeeper
RUN apt-get update && apt-get install -y \
    libzookeeper-st2 \
    libzookeeper-mt2 \
    libzookeeper-mt-dev

RUN cd /root && \
    curl -o /tmp/php-zookeeper.tar.gz https://github.com/php-zookeeper/php-zookeeper/archive/v0.6.3.tar.gz -L && \
    tar zxvf /tmp/php-zookeeper.tar.gz && cd php-zookeeper* && \
    phpize && \
    ./configure \
    && make && make install && \
    docker-php-ext-enable zookeeper && \
    rm -rf /tmp/*

RUN curl -sS https://getcomposer.org/installer | \
php -- --install-dir=/usr/bin/ --filename=composer \
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

RUN apt-get autoclean clean autoremove
